/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.common.util.httpclient;


/**
 * 
 * HTTP结果信息，用于把状态码和描述重新组装成一个对象返回
 * @Title com.enfry.util.httpclient.HttpResult
 * @author Penghu
 * @date 2016年11月10日
 */
public class HttpResult
{
    private int responseStatus;
    private String responseText;
    
    private byte[] responseBytes;
    
    public HttpResult(int responseStatus, String responseText)
    {
        this.responseStatus = responseStatus;
        this.responseText = responseText;
    }

    public HttpResult(int responseStatus, String responseText, byte[] responseBytes)
    {
        this.responseStatus = responseStatus;
        this.responseText = responseText;
        this.responseBytes = responseBytes;
    }
    
    /** 获取状态码 */
    public int getResponseStatus()
    {
        return responseStatus;
    }

    /** 获取状态信息或响应内容 */
    public String getResponseText()
    {
        return responseText;
    }
    
    /** 获取状态信息或响应字节 */
    public byte[] getResponseBytes()
    {
        return responseBytes;
    }
    
    
    /** 判断是否成功 */
    public boolean isSuccess()
    {
        return responseStatus == 200;
    }
}
